package com.raccoonagents.tools.cascet2d.model.components;

import java.awt.Shape;

import com.raccoonagents.tools.cascet2d.interfaces.IRenderableStageElement;
import com.raccoonagents.tools.cascet2d.interfaces.IShapedStageElement;
import com.raccoonagents.tools.cascet2d.interfaces.rendering.IRenderable;
import com.raccoonagents.tools.cascet2d.model.Vector2f;
/**
 * 
 * @author Kari Kuvaja
 *
 */

public abstract class AbstractStageComponent implements IShapedStageElement, IRenderable{

	protected Vector2f localLocation = new Vector2f(0.0f,0.0f);
	protected IRenderableStageElement parent;
	protected Vector2f size;
	protected float localRotation;
	
	protected boolean visible = true;
	
	public boolean isVisible() {
		return visible;
	}

	public void setVisible(final boolean visible) {
		this.visible = visible;
	}

	@Override
	public Vector2f getLocation() {
		return localLocation;
	}
	
	@Override
	public IRenderableStageElement getParentElement() {
		return parent;
	}
	
	public Vector2f getSize(){
		return size;
	}
	
	@Override
	public final Vector2f getWorldCoordinates(final Vector2f localCoordinates) {
		return parent.getWorldCoordinates(localCoordinates.add(localLocation));
	}
	
	@Override
	public final void setLocation(final Vector2f location) {
		this.localLocation = location;
	}
	
	@Override
	public void setParentElement(final IRenderableStageElement element) {
		this.parent = element;
		
	}
	
	
	public float getRotation() {
		return localRotation;
	}
	/*
	@Override
	public float getWorldRotation(final float myRotation) {
		return parent.getWorldRotation(myRotation + getRotation());
	}*/

	public void setRotation(final float rotation) {
		this.localRotation = rotation;
	}
	
	@Override
	public void setShape(final Shape shape) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public Shape getShape() {
		return null;
	}
}
